<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>b5laravelcmf</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="csrf-token" content="Kk227jcqpSIBYeTG8SyRFHDbjXutbw2JvBgr6TM4">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="/static/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/plugins/fontawesome/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/static/plugins/jquery-layout/layout-default.css">
    <link rel="stylesheet" href="/static/plugins/ztree/css/metroStyle/metroStyle.css">
    <link href="/static/plugins/layui/css/layui.css" rel="stylesheet">
    <link href="/static/plugins/animate/animate.css" rel="stylesheet"/>
    <link href="/static/admin/css/style.css" rel="stylesheet"/>
    <link href="/static/admin/css/iframe-ui.css" rel="stylesheet"/>
    <script>
        var bootUrl = {
            url: '/admin/user/index',
            createUrl: '/admin/user/create',
            updateUrl: '/admin/user/update',
            removeUrl: '/admin/user/remove',
            removeAllUrl: '/admin/user/removeAll',
            clearCacheUrl: '/admin/user/clearCache',
        }
    </script>
</head>
<body class="gray-bg">
<div class="ui-layout-west">
    <div class="box box-main">
        <div class="box-header">
            <div class="box-title">
                <i class="fa icon-grid"></i> 组织机构
            </div>
            <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" title="组织架构管理" onclick="$.modal.openTab('组织架构', struct_indexUrl);"><i class="fa fa-edit"></i></button>
                <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
                <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
                <button type="button" class="btn btn-box-tool" title="刷新组织" onclick="getStructList()"><i class="fa fa-refresh"></i></button>
            </div>
        </div>
        <div class="ui-layout-content">
            <div id="tree" class="ztree"></div>
        </div>
    </div>
</div>

<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="role-form">
                    <input
                            type="hidden"
                            name="structId"
                            value=""
                            id="structId"                                 autocomplete="off"
                    />


                    <div class="select-list">
                        <ul>
                            <li>人员名称：
                                <input
                                        type=" text "
                                        name="like[realname]"
                                        value=""
                                        autocomplete="off"
                                />


                            </li>
                            <li>登录名：
                                <input
                                        type=" text "
                                        name="where[username]"
                                        value=""
                                        autocomplete="off"
                                />


                            </li>
                            <li>人员状态：
                                <select
                                        name="where[status]"
                                >
                                    <option value="">所有</option>
                                    <option value="1"

                                    >正常</option>
                                    <option value="0"

                                    >停用</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success "
                   onclick="$.operate.add('',this)"
                   data-width=""
                   data-height=""
                >
                    <i class="fa fa-plus"></i> 新增
                </a>

                <a
                        class="btn btn-primary single "
                        onclick="$.operate.edit('',this)"
                >
                    <i class="fa fa-edit"></i> 修改
                </a>

                <a class="btn btn-danger multiple " onclick="$.operate.removeAll(this)" data-column="">
                    <i class="fa fa-remove"></i> 删除
                </a>

            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>
<script src="/static/plugins/jquery/jquery-1.12.4.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.min.js?v=asdasd"></script>
<!-- bootstrap-table 表格插件 -->
<script src="/static/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/static/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/static/plugins/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="/static/plugins/validate/jquery.validate.min.js"></script>
<script src="/static/plugins/validate/messages_zh.min.js"></script>
<script src="/static/plugins/validate/jquery.validate.extend.js"></script>
<script src="/static/plugins/jquery-layout/jquery.layout.min.js"></script>
<script src="/static/plugins/ztree/js/jquery.ztree.all.min.js"></script>
<script src="/static/plugins/ztree/js/jquery.ztree.exhide.min.js"></script>
<script src="/static/plugins/blockUI/jquery.blockUI.js"></script>
<script src="/static/plugins/iCheck/icheck.min.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<script src="/static/admin/js/iframe-ui.js"></script>
<script src="/static/admin/js/common.js"></script>
<script>
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({ initClosed: panehHidden, west__size: 185,togglerContent_open:"<i class='fa fa-caret-left'></i>",togglerContent_closed:"<i class='fa fa-caret-right'></i>" });
        getStructList();
        getUserList();

        $('#btnExpand').click(function() {
            $._tree.expandAll(true);
            $(this).hide();
            $('#btnCollapse').show();
        });

        $('#btnCollapse').click(function() {
            $._tree.expandAll(false);
            $(this).hide();
            $('#btnExpand').show();
        });
    });
    function getStructList() {
        var options = {
            url: '/admin/struct/tree',
            expandLevel: 2,
            onClick : zOnClick
        };
        $.tree.init(options);
        $("#structId").val('');
        $.table.search();
        function zOnClick(event, treeId, treeNode) {
            $("#structId").val(treeNode.id);
            $.table.search();
        }
    }
    function getUserList() {
        var options = {
            modalName: "人员",
            columns: [
                {checkbox: true},
                {field: 'id', title: '用户ID', align: 'center', sortable: true},
                {field: 'username', align: 'center', title: '登录名称'},
                {field: 'realname', align: 'center', title: '用户名称'},
                {
                    field: 'structname',
                    title: '组织架构',
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,9);
                    }
                },
                {
                    title: '状态',
                    field: 'status',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.view.statusTools(row,true);
                    }
                },
                {
                    field: 'rolename',
                    title: '角色分组',
                    visible: false,
                    formatter:function (value, row, index) {
                        return $.table.tooltip(value,9);
                    }
                },
                {field: 'last_time', align: 'center', title: '登陆时间',visible: false},
                {field: 'last_ip', align: 'center', title: '登陆ip',visible: false},
                {field: 'create_time', title: '创建时间', align: 'center', sortable: true,visible: false},
                {field: 'update_time', title: '更新时间', align: 'center', sortable: true},
                {field: 'note', title: '备注', visible: false},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return '<a class="btn btn-success btn-xs" href="javascript:;" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a>                                                                                                      <a class="btn btn-danger btn-xs" href="javascript:;" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>             ';
                    }
                }
            ]
        };


        $.table.init(options);
    }
</script>
</body>
</html>
